import Vue from "vue";
import VueRouter, { RouteConfig } from "vue-router";
import Address from "@/views/address/index.vue";
const Login = () => import(/* webpackChunkName: "login" */ "../views/login/index.vue")
const Home = () => import(/* webpackChunkName: "home" */ "../views/Home.vue")
const MyOrder = () => import(/* webpackChunkName: "myorder" */ "../views/my-order/index.vue")
const IssueOrder = () => import(/* webpackChunkName: "issueorder" */ "../views/issue-order/index.vue")

Vue.use(VueRouter);

const routes: Array<RouteConfig> = [
  {
    path: "/",
    redirect: '/login',
    component: Login
  },
  {
    path: "/login",
    name: "Login",
    component: Login,
  },
  {
    path:'/home',
    name:'home',
    component: Home,
    redirect: '/issueOrder',
    children:[
      {
        path:'/issueOrder',
        name:'IssueOrder',
        component: IssueOrder
      },
      {
        path:'/myOrder',
        name:'MyOrder',
        component: MyOrder
      },
      {
        path:'/address',
        name:'Address',
        component:Address
      }
    ]
  },

];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
